package cn.laixueit.controller;

import cn.laixueit.pojo.SearchRequest;
import cn.laixueit.pojo.SearchResult;
import cn.laixueit.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@Controller
public class SearchController {

    @Autowired
    private SearchService searchService;

    @PostMapping("/page")
    public ResponseEntity<SearchResult>  page(@RequestBody SearchRequest searchRequest){

        SearchResult searchResult = searchService.search(searchRequest);

        return ResponseEntity.ok(searchResult);
    }
}
